package web.hibernate;

import javax.persistence.*;
import java.util.Arrays;

/**
 * Created by IntelliJ IDEA.
 * User: user
 * Date: Jan 31, 2010
 * Time: 9:15:02 PM
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(catalog = "strutshibernatespring", name = "login")
public class LoginEntity {
  private long id;

  @Id
  @Column(name = "id", nullable = false, length = 10)
  public long getId() {
    return id;
  }

  public void setId(long id) {
    this.id = id;
  }

  private char[] loginid;

  @Basic
  @Column(name = "loginid", nullable = false, length = 20)
  public char[] getLoginid() {
    return loginid;
  }

  public void setLoginid(char[] loginid) {
    this.loginid = loginid;
  }

  private char[] password;

  @Basic
  @Column(name = "password", nullable = false, length = 20)
  public char[] getPassword() {
    return password;
  }

  public void setPassword(char[] password) {
    this.password = password;
  }

  private char[] email;

  @Basic
  @Column(name = "email", length = 30)
  public char[] getEmail() {
    return email;
  }

  public void setEmail(char[] email) {
    this.email = email;
  }

  private char[] address;

  @Basic
  @Column(name = "address", length = 60)
  public char[] getAddress() {
    return address;
  }

  public void setAddress(char[] address) {
    this.address = address;
  }

  private long phno;

  @Basic
  @Column(name = "phno", length = 10)
  public long getPhno() {
    return phno;
  }

  public void setPhno(long phno) {
    this.phno = phno;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    LoginEntity that = (LoginEntity) o;

    if (id != that.id) return false;
    if (phno != that.phno) return false;
    if (!Arrays.equals(address, that.address)) return false;
    if (!Arrays.equals(email, that.email)) return false;
    if (!Arrays.equals(loginid, that.loginid)) return false;
    if (!Arrays.equals(password, that.password)) return false;

    return true;
  }

  @Override
  public int hashCode() {
    int result = (int) (id ^ (id >>> 32));
    result = 31 * result + (loginid != null ? Arrays.hashCode(loginid) : 0);
    result = 31 * result + (password != null ? Arrays.hashCode(password) : 0);
    result = 31 * result + (email != null ? Arrays.hashCode(email) : 0);
    result = 31 * result + (address != null ? Arrays.hashCode(address) : 0);
    result = 31 * result + (int) (phno ^ (phno >>> 32));
    return result;
  }
}
